|
![](/i/fill.gif) |
Update:
I think I figured out that the normal I was calculating was the normal for
each vertex rather than the normal for the plane. My misunderstanding. If
I understand that correctly than I should need to calculate 6 vectors and
average them together rather than 2.
So I have tried this:
mesh {
#local P1 = <x1, y1, z1>;
#local P2 = <x2, y2, z2>;
#local P3 = <x3, y3, z3>;
#local P4 = <x4, y4, z4>;
#local N1 = vnormalize(vcross(P3 - P1, P2 - P1));
#local N2 = vnormalize(vcross(P1 - P2, P3 - P2));
#local N3 = vnormalize(vcross(P1 - P3, P2 - P3));
#local N4 = vnormalize(vcross(P4 - P3, P2 - P3));
#local N5 = vnormalize(vcross(P3 - P2, P4 - P2));
#local N6 = vnormalize(vcross(P3 - P4, P2 - P4));
#local N = (N1 + N2 + N3 + N4 + N5 + N6)/6;
smooth_triangle { P1, N, P2, N, P3, N }
smooth_triangle { P2, N, P3, N, P4, N }
}
I still end up with the same shading problem.
I'd love to know what I'm missing.
Post a reply to this message
|
![](/i/fill.gif) |